﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entities;
using DataAccess;

namespace InsuranceVehicle.AdminSite
{
    public partial class NewVehicle : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            EmployeeInfo emp = new EmployeeInfo();
            emp = (EmployeeInfo)Session["Employee"];
            if (emp != null)
            {
                if (emp.Department == 1)
                {
                    Menu1.ShowElement = "all";
                }
                else
                {
                    Menu1.ShowElement = "no";
                }
            }
            else
            {
                Response.Redirect("LoginAdmin.aspx");
            }
        }

        protected void btnChangePass_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                VehicleDataAccess vda = new VehicleDataAccess();
                VehicleInfo v = new VehicleInfo();

                v.Model = txtModel.Text;
                v.NumberOfSeat = Convert.ToInt32(txtSeat.Text);
                lblSuccess.Visible = true;
                lblSuccess.Text = vda.InsertVehicle(v);
            }
        }
    }
}